/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    ap-northeast-1 = 'resellertrade.aliyuncs.com',
    ap-northeast-2-pop = 'resellertrade.aliyuncs.com',
    ap-south-1 = 'resellertrade.aliyuncs.com',
    ap-southeast-1 = 'resellertrade.aliyuncs.com',
    ap-southeast-2 = 'resellertrade.aliyuncs.com',
    ap-southeast-3 = 'resellertrade.aliyuncs.com',
    ap-southeast-5 = 'resellertrade.aliyuncs.com',
    cn-beijing = 'resellertrade.aliyuncs.com',
    cn-beijing-finance-1 = 'resellertrade.aliyuncs.com',
    cn-beijing-finance-pop = 'resellertrade.aliyuncs.com',
    cn-beijing-gov-1 = 'resellertrade.aliyuncs.com',
    cn-beijing-nu16-b01 = 'resellertrade.aliyuncs.com',
    cn-chengdu = 'resellertrade.aliyuncs.com',
    cn-edge-1 = 'resellertrade.aliyuncs.com',
    cn-fujian = 'resellertrade.aliyuncs.com',
    cn-haidian-cm12-c01 = 'resellertrade.aliyuncs.com',
    cn-hangzhou = 'resellertrade.aliyuncs.com',
    cn-hangzhou-bj-b01 = 'resellertrade.aliyuncs.com',
    cn-hangzhou-finance = 'resellertrade.aliyuncs.com',
    cn-hangzhou-internal-prod-1 = 'resellertrade.aliyuncs.com',
    cn-hangzhou-internal-test-1 = 'resellertrade.aliyuncs.com',
    cn-hangzhou-internal-test-2 = 'resellertrade.aliyuncs.com',
    cn-hangzhou-internal-test-3 = 'resellertrade.aliyuncs.com',
    cn-hangzhou-test-306 = 'resellertrade.aliyuncs.com',
    cn-hongkong = 'resellertrade.aliyuncs.com',
    cn-hongkong-finance-pop = 'resellertrade.aliyuncs.com',
    cn-huhehaote = 'resellertrade.aliyuncs.com',
    cn-north-2-gov-1 = 'resellertrade.aliyuncs.com',
    cn-qingdao = 'resellertrade.aliyuncs.com',
    cn-qingdao-nebula = 'resellertrade.aliyuncs.com',
    cn-shanghai = 'resellertrade.aliyuncs.com',
    cn-shanghai-et15-b01 = 'resellertrade.aliyuncs.com',
    cn-shanghai-et2-b01 = 'resellertrade.aliyuncs.com',
    cn-shanghai-finance-1 = 'resellertrade.aliyuncs.com',
    cn-shanghai-inner = 'resellertrade.aliyuncs.com',
    cn-shanghai-internal-test-1 = 'resellertrade.aliyuncs.com',
    cn-shenzhen = 'resellertrade.aliyuncs.com',
    cn-shenzhen-finance-1 = 'resellertrade.aliyuncs.com',
    cn-shenzhen-inner = 'resellertrade.aliyuncs.com',
    cn-shenzhen-st4-d01 = 'resellertrade.aliyuncs.com',
    cn-shenzhen-su18-b01 = 'resellertrade.aliyuncs.com',
    cn-wuhan = 'resellertrade.aliyuncs.com',
    cn-yushanfang = 'resellertrade.aliyuncs.com',
    cn-zhangbei-na61-b01 = 'resellertrade.aliyuncs.com',
    cn-zhangjiakou = 'resellertrade.aliyuncs.com',
    cn-zhangjiakou-na62-a01 = 'resellertrade.aliyuncs.com',
    cn-zhengzhou-nebula-1 = 'resellertrade.aliyuncs.com',
    eu-central-1 = 'resellertrade.aliyuncs.com',
    eu-west-1 = 'resellertrade.aliyuncs.com',
    eu-west-1-oxs = 'resellertrade.aliyuncs.com',
    me-east-1 = 'resellertrade.aliyuncs.com',
    rus-west-1-pop = 'resellertrade.aliyuncs.com',
    us-east-1 = 'resellertrade.aliyuncs.com',
    us-west-1 = 'resellertrade.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('resellertrade', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateCouponTemplateRequest {
  activitySite?: int32(name='ActivitySite', example='0'),
  bid?: long(name='Bid', example='26888'),
  certainMoney?: double(name='CertainMoney', example='200'),
  clientType?: string(name='ClientType', example='UNIVERSAL'),
  commodityType?: string(name='CommodityType', example='FULLSITE_SELF'),
  controlType?: string(name='ControlType', example='AMOUNT'),
  couponAmount?: double(name='CouponAmount', example='100'),
  couponEndTime?: string(name='CouponEndTime', example='1577851200'),
  couponFixedType?: string(name='CouponFixedType', example='FIXED'),
  couponStartTime?: string(name='CouponStartTime', example='1577851200'),
  couponType?: string(name='CouponType', example='VOUCHER'),
  currency?: {
    currencyCode?: string(name='CurrencyCode', example='USD'),
    defaultFractionDigits?: int32(name='DefaultFractionDigits'),
    numericCode?: int32(name='NumericCode'),
  }(name='Currency'),
  description?: string(name='Description'),
  discountRate?: double(name='DiscountRate', example='0.8'),
  endTime?: string(name='EndTime', example='1577851200'),
  extendsMap?: map[string]string(name='ExtendsMap'),
  fromApp?: string(name='FromApp', example='test'),
  itemCodeSet?: [ string ](name='ItemCodeSet'),
  market?: string(name='Market', example='INTL'),
  marketType?: long(name='MarketType', example='9'),
  maxRelease?: double(name='MaxRelease', example='100'),
  messageId?: string(name='MessageId'),
  name?: string(name='Name'),
  operator?: string(name='Operator', example='xxx'),
  orderTypeSet?: [ string ](name='OrderTypeSet'),
  perLimitNum?: int32(name='PerLimitNum', example='1'),
  promotionId?: long(name='PromotionId', example='1231'),
  reason?: string(name='Reason'),
  relativeSecond?: int32(name='RelativeSecond', example='10'),
  requestId?: string(name='RequestId', example='vsdvnjwegiq'),
  selectionIdSet?: [ string ](name='SelectionIdSet'),
  sellerId?: long(name='SellerId', example='123123563464'),
  site?: string(name='Site', example='INTL'),
  spId?: long(name='SpId', example='123123'),
  startTime?: string(name='StartTime', example='1577851200'),
  type?: string(name='Type', example='APPLY'),
  universalType?: string(name='UniversalType', example='UNIVERSAL'),
  upperLimit?: double(name='UpperLimit', example='100'),
  usageCount?: int32(name='UsageCount', example='0'),
  useScene?: string(name='UseScene', example='TEST'),
  userPkAmount?: string(name='UserPkAmount', example='12341234,100'),
  validityType?: string(name='ValidityType', example='RELATIVE'),
}

model CreateCouponTemplateResponseBody = {
  code?: string(name='Code', example='succecc'),
  contextMap?: map[string]any(name='ContextMap'),
  data?: long(name='Data', description='result data', example='123'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='123fjsj'),
  success?: boolean(name='Success', example='true'),
}

model CreateCouponTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCouponTemplateResponseBody(name='body'),
}

async function createCouponTemplateWithOptions(request: CreateCouponTemplateRequest, runtime: Util.RuntimeOptions): CreateCouponTemplateResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.activitySite)) {
    body['ActivitySite'] = request.activitySite;
  }
  if (!Util.isUnset(request.bid)) {
    body['Bid'] = request.bid;
  }
  if (!Util.isUnset(request.certainMoney)) {
    body['CertainMoney'] = request.certainMoney;
  }
  if (!Util.isUnset(request.clientType)) {
    body['ClientType'] = request.clientType;
  }
  if (!Util.isUnset(request.commodityType)) {
    body['CommodityType'] = request.commodityType;
  }
  if (!Util.isUnset(request.controlType)) {
    body['ControlType'] = request.controlType;
  }
  if (!Util.isUnset(request.couponAmount)) {
    body['CouponAmount'] = request.couponAmount;
  }
  if (!Util.isUnset(request.couponEndTime)) {
    body['CouponEndTime'] = request.couponEndTime;
  }
  if (!Util.isUnset(request.couponFixedType)) {
    body['CouponFixedType'] = request.couponFixedType;
  }
  if (!Util.isUnset(request.couponStartTime)) {
    body['CouponStartTime'] = request.couponStartTime;
  }
  if (!Util.isUnset(request.couponType)) {
    body['CouponType'] = request.couponType;
  }
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.currency)) {
    bodyFlat['Currency'] = request.currency;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.discountRate)) {
    body['DiscountRate'] = request.discountRate;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.extendsMap)) {
    bodyFlat['ExtendsMap'] = request.extendsMap;
  }
  if (!Util.isUnset(request.fromApp)) {
    body['FromApp'] = request.fromApp;
  }
  if (!Util.isUnset(request.itemCodeSet)) {
    body['ItemCodeSet'] = request.itemCodeSet;
  }
  if (!Util.isUnset(request.market)) {
    body['Market'] = request.market;
  }
  if (!Util.isUnset(request.marketType)) {
    body['MarketType'] = request.marketType;
  }
  if (!Util.isUnset(request.maxRelease)) {
    body['MaxRelease'] = request.maxRelease;
  }
  if (!Util.isUnset(request.messageId)) {
    body['MessageId'] = request.messageId;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.operator)) {
    body['Operator'] = request.operator;
  }
  if (!Util.isUnset(request.orderTypeSet)) {
    body['OrderTypeSet'] = request.orderTypeSet;
  }
  if (!Util.isUnset(request.perLimitNum)) {
    body['PerLimitNum'] = request.perLimitNum;
  }
  if (!Util.isUnset(request.promotionId)) {
    body['PromotionId'] = request.promotionId;
  }
  if (!Util.isUnset(request.reason)) {
    body['Reason'] = request.reason;
  }
  if (!Util.isUnset(request.relativeSecond)) {
    body['RelativeSecond'] = request.relativeSecond;
  }
  if (!Util.isUnset(request.requestId)) {
    body['RequestId'] = request.requestId;
  }
  if (!Util.isUnset(request.selectionIdSet)) {
    body['SelectionIdSet'] = request.selectionIdSet;
  }
  if (!Util.isUnset(request.sellerId)) {
    body['SellerId'] = request.sellerId;
  }
  if (!Util.isUnset(request.site)) {
    body['Site'] = request.site;
  }
  if (!Util.isUnset(request.spId)) {
    body['SpId'] = request.spId;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  if (!Util.isUnset(request.universalType)) {
    body['UniversalType'] = request.universalType;
  }
  if (!Util.isUnset(request.upperLimit)) {
    body['UpperLimit'] = request.upperLimit;
  }
  if (!Util.isUnset(request.usageCount)) {
    body['UsageCount'] = request.usageCount;
  }
  if (!Util.isUnset(request.useScene)) {
    body['UseScene'] = request.useScene;
  }
  if (!Util.isUnset(request.userPkAmount)) {
    body['UserPkAmount'] = request.userPkAmount;
  }
  if (!Util.isUnset(request.validityType)) {
    body['ValidityType'] = request.validityType;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateCouponTemplate',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createCouponTemplate(request: CreateCouponTemplateRequest): CreateCouponTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCouponTemplateWithOptions(request, runtime);
}

model DiscardCouponListRequest {
  couponList?: [ long ](name='CouponList'),
}

model DiscardCouponListResponseBody = {
  code?: string(name='Code', example='true'),
  contextMap?: map[string]any(name='ContextMap'),
  data?: boolean(name='Data', description='result data', example='true'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='12gmgwhb'),
  success?: boolean(name='Success', example='true'),
}

model DiscardCouponListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DiscardCouponListResponseBody(name='body'),
}

async function discardCouponListWithOptions(request: DiscardCouponListRequest, runtime: Util.RuntimeOptions): DiscardCouponListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.couponList)) {
    body['CouponList'] = request.couponList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DiscardCouponList',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function discardCouponList(request: DiscardCouponListRequest): DiscardCouponListResponse {
  var runtime = new Util.RuntimeOptions{};
  return discardCouponListWithOptions(request, runtime);
}

model GetCouponPageRequest {
  fromApp?: string(name='FromApp'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  sellerId?: long(name='SellerId'),
  templateId?: long(name='TemplateId'),
  uids?: [ long ](name='Uids'),
}

model GetCouponPageResponseBody = {
  code?: string(name='Code'),
  contextMap?: map[string]any(name='ContextMap'),
  count?: int32(name='Count'),
  data?: [ 
    {
      amount?: double(name='Amount'),
      certainMoney?: double(name='CertainMoney'),
      couponId?: long(name='CouponId'),
      couponType?: string(name='CouponType'),
      currency?: {
        currencyCode?: string(name='CurrencyCode'),
      }(name='Currency'),
      description?: string(name='Description'),
      discountRate?: double(name='DiscountRate'),
      endTime?: string(name='EndTime'),
      frozenAmount?: double(name='FrozenAmount'),
      frozenCount?: int32(name='FrozenCount'),
      promotionId?: long(name='PromotionId'),
      sellerId?: long(name='SellerId'),
      startTime?: string(name='StartTime'),
      status?: string(name='Status'),
      templateId?: long(name='TemplateId'),
      universalType?: string(name='UniversalType'),
      upperLimit?: double(name='UpperLimit'),
      usageCount?: int32(name='UsageCount'),
      usedAmount?: double(name='UsedAmount'),
      usedCount?: int32(name='UsedCount'),
      userId?: long(name='UserId'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalCount?: int32(name='TotalCount'),
}

model GetCouponPageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCouponPageResponseBody(name='body'),
}

async function getCouponPageWithOptions(request: GetCouponPageRequest, runtime: Util.RuntimeOptions): GetCouponPageResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCouponPage',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCouponPage(request: GetCouponPageRequest): GetCouponPageResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCouponPageWithOptions(request, runtime);
}

model GetCustomerListRequest {
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
}

model GetCustomerListResponseBody = {
  code?: string(name='Code'),
  data?: {
    totalSize?: int32(name='TotalSize'),
    uidList?: [ string ](name='UidList'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetCustomerListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCustomerListResponseBody(name='body'),
}

async function getCustomerListWithOptions(request: GetCustomerListRequest, runtime: Util.RuntimeOptions): GetCustomerListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCustomerList',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCustomerList(request: GetCustomerListRequest): GetCustomerListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCustomerListWithOptions(request, runtime);
}

model GetRelationRequest {
  relationTime?: long(name='RelationTime'),
  uid?: long(name='Uid'),
}

model GetRelationResponseBody = {
  class?: string(name='Class'),
  code?: string(name='Code'),
  data?: {
    canLoginOfficial?: boolean(name='CanLoginOfficial'),
    class?: string(name='Class'),
    endTime?: long(name='EndTime'),
    resellerProductModeDO?: {
      class?: string(name='Class'),
      isService?: long(name='IsService'),
      productCode?: string(name='ProductCode'),
      productName?: string(name='ProductName'),
    }(name='ResellerProductModeDO'),
    resellerProductRuleDO?: {
      class?: string(name='Class'),
      commodityRoute?: boolean(name='CommodityRoute'),
      multiOrder?: boolean(name='MultiOrder'),
      payMode?: string(name='PayMode'),
    }(name='ResellerProductRuleDO'),
    resellerUid?: long(name='ResellerUid'),
    startTime?: long(name='StartTime'),
    status?: string(name='Status'),
    topReseller?: boolean(name='TopReseller'),
    uid?: long(name='Uid'),
    userType?: string(name='UserType'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetRelationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetRelationResponseBody(name='body'),
}

async function getRelationWithOptions(request: GetRelationRequest, runtime: Util.RuntimeOptions): GetRelationResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRelation',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getRelation(request: GetRelationRequest): GetRelationResponse {
  var runtime = new Util.RuntimeOptions{};
  return getRelationWithOptions(request, runtime);
}

model GetResellerPayOrderRequest {
  orderId?: string(name='OrderId'),
  uid?: long(name='Uid'),
}

model GetResellerPayOrderResponseBody = {
  code?: string(name='Code'),
  data?: {
    buyerId?: string(name='BuyerId'),
    orderId?: string(name='OrderId'),
    orderStatus?: string(name='OrderStatus'),
    payAmount?: string(name='PayAmount'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetResellerPayOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResellerPayOrderResponseBody(name='body'),
}

async function getResellerPayOrderWithOptions(request: GetResellerPayOrderRequest, runtime: Util.RuntimeOptions): GetResellerPayOrderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.orderId)) {
    query['OrderId'] = request.orderId;
  }
  if (!Util.isUnset(request.uid)) {
    query['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResellerPayOrder',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getResellerPayOrder(request: GetResellerPayOrderRequest): GetResellerPayOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResellerPayOrderWithOptions(request, runtime);
}

model LabelPartnerUserRequest {
  userPK?: long(name='UserPK'),
  userTag?: string(name='UserTag'),
}

model LabelPartnerUserResponseBody = {
  code?: string(name='Code'),
  data?: {
    userPK?: long(name='UserPK'),
    userTag?: string(name='UserTag'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model LabelPartnerUserResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: LabelPartnerUserResponseBody(name='body'),
}

async function labelPartnerUserWithOptions(request: LabelPartnerUserRequest, runtime: Util.RuntimeOptions): LabelPartnerUserResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.userPK)) {
    body['UserPK'] = request.userPK;
  }
  if (!Util.isUnset(request.userTag)) {
    body['UserTag'] = request.userTag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'LabelPartnerUser',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function labelPartnerUser(request: LabelPartnerUserRequest): LabelPartnerUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return labelPartnerUserWithOptions(request, runtime);
}

model MigrateResourceRequest {
  actionCode?: string(name='ActionCode'),
  content?: string(name='Content'),
}

model MigrateResourceResponseBody = {
  code?: string(name='Code'),
  data?: {
    content?: string(name='Content'),
    procEnvir?: string(name='ProcEnvir'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model MigrateResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: MigrateResourceResponseBody(name='body'),
}

async function migrateResourceWithOptions(request: MigrateResourceRequest, runtime: Util.RuntimeOptions): MigrateResourceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.actionCode)) {
    body['ActionCode'] = request.actionCode;
  }
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'MigrateResource',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function migrateResource(request: MigrateResourceRequest): MigrateResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return migrateResourceWithOptions(request, runtime);
}

model OfflineActivityRequest {
  activityList?: [ long ](name='ActivityList'),
  bizId?: string(name='BizId'),
  token?: string(name='Token'),
}

model OfflineActivityResponseBody = {
  code?: string(name='Code'),
  contextMap?: map[string]any(name='ContextMap'),
  data?: [ long ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model OfflineActivityResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: OfflineActivityResponseBody(name='body'),
}

async function offlineActivityWithOptions(request: OfflineActivityRequest, runtime: Util.RuntimeOptions): OfflineActivityResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.activityList)) {
    body['ActivityList'] = request.activityList;
  }
  if (!Util.isUnset(request.bizId)) {
    body['BizId'] = request.bizId;
  }
  if (!Util.isUnset(request.token)) {
    body['Token'] = request.token;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'OfflineActivity',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function offlineActivity(request: OfflineActivityRequest): OfflineActivityResponse {
  var runtime = new Util.RuntimeOptions{};
  return offlineActivityWithOptions(request, runtime);
}

model PayResultCallbackRequest {
  orderId?: string(name='OrderId'),
  payStatus?: string(name='PayStatus'),
  payTime?: string(name='PayTime'),
  uid?: long(name='Uid'),
}

model PayResultCallbackResponseBody = {
  code?: string(name='Code'),
  data?: boolean(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model PayResultCallbackResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PayResultCallbackResponseBody(name='body'),
}

async function payResultCallbackWithOptions(request: PayResultCallbackRequest, runtime: Util.RuntimeOptions): PayResultCallbackResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.orderId)) {
    query['OrderId'] = request.orderId;
  }
  if (!Util.isUnset(request.payStatus)) {
    query['PayStatus'] = request.payStatus;
  }
  if (!Util.isUnset(request.payTime)) {
    query['PayTime'] = request.payTime;
  }
  if (!Util.isUnset(request.uid)) {
    query['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PayResultCallback',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function payResultCallback(request: PayResultCallbackRequest): PayResultCallbackResponse {
  var runtime = new Util.RuntimeOptions{};
  return payResultCallbackWithOptions(request, runtime);
}

model PublicActivityRequest {
  activityList?: [ long ](name='ActivityList'),
  bizId?: string(name='BizId'),
  snapType?: string(name='SnapType'),
  token?: string(name='Token'),
}

model PublicActivityResponseBody = {
  code?: string(name='Code'),
  contextMap?: map[string]any(name='ContextMap'),
  data?: [ long ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model PublicActivityResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PublicActivityResponseBody(name='body'),
}

async function publicActivityWithOptions(request: PublicActivityRequest, runtime: Util.RuntimeOptions): PublicActivityResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.activityList)) {
    body['ActivityList'] = request.activityList;
  }
  if (!Util.isUnset(request.bizId)) {
    body['BizId'] = request.bizId;
  }
  if (!Util.isUnset(request.snapType)) {
    body['SnapType'] = request.snapType;
  }
  if (!Util.isUnset(request.token)) {
    body['Token'] = request.token;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PublicActivity',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function publicActivity(request: PublicActivityRequest): PublicActivityResponse {
  var runtime = new Util.RuntimeOptions{};
  return publicActivityWithOptions(request, runtime);
}

model QueryActivityRequest {
  activityId?: long(name='ActivityId'),
  bizId?: string(name='BizId'),
  snapType?: string(name='SnapType'),
}

model QueryActivityResponseBody = {
  code?: string(name='Code'),
  contextMap?: map[string]any(name='ContextMap'),
  data?: {
    activityId?: long(name='ActivityId'),
    activityName?: string(name='ActivityName'),
    blackList?: [ long ](name='BlackList'),
    commodityCodeList?: [ string ](name='CommodityCodeList'),
    description?: string(name='Description'),
    endTime?: string(name='EndTime'),
    extMap?: map[string]string(name='ExtMap'),
    promotionDescription?: string(name='PromotionDescription'),
    promotionValue?: double(name='PromotionValue'),
    regionList?: [ string ](name='RegionList'),
    sellerIdList?: [ long ](name='SellerIdList'),
    startTime?: string(name='StartTime'),
    status?: string(name='Status'),
    testAccountList?: [ long ](name='TestAccountList'),
    whiteList?: [ long ](name='WhiteList'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryActivityResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryActivityResponseBody(name='body'),
}

async function queryActivityWithOptions(request: QueryActivityRequest, runtime: Util.RuntimeOptions): QueryActivityResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.activityId)) {
    body['ActivityId'] = request.activityId;
  }
  if (!Util.isUnset(request.bizId)) {
    body['BizId'] = request.bizId;
  }
  if (!Util.isUnset(request.snapType)) {
    body['SnapType'] = request.snapType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryActivity',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryActivity(request: QueryActivityRequest): QueryActivityResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryActivityWithOptions(request, runtime);
}

model QueryEcoRelationRequest {
  relationTime?: string(name='RelationTime'),
  uid?: long(name='Uid'),
}

model QueryEcoRelationResponseBody = {
  code?: string(name='Code'),
  contextMap?: map[string]any(name='ContextMap'),
  data?: {
    canLoginOfficial?: boolean(name='CanLoginOfficial'),
    endTime?: string(name='EndTime'),
    isTopReseller?: boolean(name='IsTopReseller'),
    resellerProductModeDO?: {
      isService?: int32(name='IsService'),
      productCode?: string(name='ProductCode'),
      productName?: string(name='ProductName'),
    }(name='ResellerProductModeDO'),
    resellerProductRuleDO?: {
      commodityRoute?: boolean(name='CommodityRoute'),
      multiOrder?: boolean(name='MultiOrder'),
      payMode?: string(name='PayMode'),
    }(name='ResellerProductRuleDO'),
    resellerUid?: long(name='ResellerUid'),
    startTime?: string(name='StartTime'),
    status?: string(name='Status'),
    uid?: long(name='Uid'),
    userType?: string(name='UserType'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryEcoRelationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryEcoRelationResponseBody(name='body'),
}

async function queryEcoRelationWithOptions(request: QueryEcoRelationRequest, runtime: Util.RuntimeOptions): QueryEcoRelationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.relationTime)) {
    body['RelationTime'] = request.relationTime;
  }
  if (!Util.isUnset(request.uid)) {
    body['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryEcoRelation',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryEcoRelation(request: QueryEcoRelationRequest): QueryEcoRelationResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryEcoRelationWithOptions(request, runtime);
}

model SaveActivityRequest {
  activityName?: string(name='ActivityName'),
  bizId?: string(name='BizId'),
  blackUidList?: [ long ](name='BlackUidList'),
  description?: string(name='Description'),
  endTime?: string(name='EndTime'),
  extendMap?: map[string]any(name='ExtendMap'),
  fusionPromotionParamList?: [ 
    {
      commodityCodeList?: [ string ](name='CommodityCodeList'),
      promotionValue?: double(name='PromotionValue'),
      restrictedRegionList?: [ string ](name='RestrictedRegionList'),
      moduleInfoParamList?: [ 
        {
          componentCode?: string(name='componentCode'),
          itemCode?: string(name='itemCode'),
          moduleId?: long(name='moduleId'),
          moduleKey?: string(name='moduleKey'),
          moduleName?: string(name='moduleName'),
          moduleValueList?: [ string ](name='moduleValueList'),
          pricePlanId?: long(name='pricePlanId'),
        }
      ](name='moduleInfoParamList'),
    }
  ](name='FusionPromotionParamList'),
  publishTag?: string(name='PublishTag'),
  startTime?: string(name='StartTime'),
  testAccountUidList?: [ long ](name='TestAccountUidList'),
  token?: string(name='Token'),
  whiteUidList?: [ long ](name='WhiteUidList'),
}

model SaveActivityShrinkRequest {
  activityName?: string(name='ActivityName'),
  bizId?: string(name='BizId'),
  blackUidList?: [ long ](name='BlackUidList'),
  description?: string(name='Description'),
  endTime?: string(name='EndTime'),
  extendMapShrink?: string(name='ExtendMap'),
  fusionPromotionParamList?: [ 
    {
      commodityCodeList?: [ string ](name='CommodityCodeList'),
      promotionValue?: double(name='PromotionValue'),
      restrictedRegionList?: [ string ](name='RestrictedRegionList'),
      moduleInfoParamList?: [ 
        {
          componentCode?: string(name='componentCode'),
          itemCode?: string(name='itemCode'),
          moduleId?: long(name='moduleId'),
          moduleKey?: string(name='moduleKey'),
          moduleName?: string(name='moduleName'),
          moduleValueList?: [ string ](name='moduleValueList'),
          pricePlanId?: long(name='pricePlanId'),
        }
      ](name='moduleInfoParamList'),
    }
  ](name='FusionPromotionParamList'),
  publishTag?: string(name='PublishTag'),
  startTime?: string(name='StartTime'),
  testAccountUidList?: [ long ](name='TestAccountUidList'),
  token?: string(name='Token'),
  whiteUidList?: [ long ](name='WhiteUidList'),
}

model SaveActivityResponseBody = {
  code?: string(name='Code'),
  contextMap?: map[string]any(name='ContextMap'),
  data?: [ long ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SaveActivityResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SaveActivityResponseBody(name='body'),
}

async function saveActivityWithOptions(tmpReq: SaveActivityRequest, runtime: Util.RuntimeOptions): SaveActivityResponse {
  Util.validateModel(tmpReq);
  var request = new SaveActivityShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.extendMap)) {
    request.extendMapShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.extendMap, 'ExtendMap', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.activityName)) {
    body['ActivityName'] = request.activityName;
  }
  if (!Util.isUnset(request.bizId)) {
    body['BizId'] = request.bizId;
  }
  if (!Util.isUnset(request.blackUidList)) {
    body['BlackUidList'] = request.blackUidList;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.extendMapShrink)) {
    body['ExtendMap'] = request.extendMapShrink;
  }
  if (!Util.isUnset(request.fusionPromotionParamList)) {
    body['FusionPromotionParamList'] = request.fusionPromotionParamList;
  }
  if (!Util.isUnset(request.publishTag)) {
    body['PublishTag'] = request.publishTag;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.testAccountUidList)) {
    body['TestAccountUidList'] = request.testAccountUidList;
  }
  if (!Util.isUnset(request.token)) {
    body['Token'] = request.token;
  }
  if (!Util.isUnset(request.whiteUidList)) {
    body['WhiteUidList'] = request.whiteUidList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SaveActivity',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function saveActivity(request: SaveActivityRequest): SaveActivityResponse {
  var runtime = new Util.RuntimeOptions{};
  return saveActivityWithOptions(request, runtime);
}

model SendCouponRequest {
  bid?: long(name='Bid', example='26888'),
  fromApp?: string(name='FromApp', example='xxx'),
  operator?: string(name='Operator', example='xxx'),
  requestId?: string(name='RequestId', example='vsdjomfjsb'),
  sellerId?: long(name='SellerId', example='12348576133'),
  templateId?: long(name='TemplateId', example='123'),
  userAmountModelList?: [ 
    {
      amount?: double(name='Amount', example='100'),
      uid?: long(name='Uid', example='18284742893'),
      userId?: long(name='UserId'),
      youhuiId?: long(name='YouhuiId', example='39584'),
    }
  ](name='UserAmountModelList'),
}

model SendCouponResponseBody = {
  code?: string(name='Code', example='true'),
  contextMap?: map[string]any(name='ContextMap'),
  count?: int32(name='Count', example='10'),
  data?: [ 
    {
      amount?: double(name='Amount', example='100'),
      uid?: long(name='Uid', example='12847473'),
      userId?: long(name='UserId', example='94847372'),
      youhuiId?: long(name='YouhuiId', example='19343'),
    }
  ](name='Data'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='djdiwownch'),
  success?: boolean(name='Success', example='ture'),
  totalCount?: int32(name='TotalCount', example='100'),
}

model SendCouponResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendCouponResponseBody(name='body'),
}

async function sendCouponWithOptions(request: SendCouponRequest, runtime: Util.RuntimeOptions): SendCouponResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bid)) {
    body['Bid'] = request.bid;
  }
  if (!Util.isUnset(request.fromApp)) {
    body['FromApp'] = request.fromApp;
  }
  if (!Util.isUnset(request.operator)) {
    body['Operator'] = request.operator;
  }
  if (!Util.isUnset(request.requestId)) {
    body['RequestId'] = request.requestId;
  }
  if (!Util.isUnset(request.sellerId)) {
    body['SellerId'] = request.sellerId;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.userAmountModelList)) {
    body['UserAmountModelList'] = request.userAmountModelList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendCoupon',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendCoupon(request: SendCouponRequest): SendCouponResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendCouponWithOptions(request, runtime);
}

model TransferResourceRequest {
  actionCode?: string(name='ActionCode'),
  content?: string(name='Content'),
}

model TransferResourceResponseBody = {
  code?: string(name='Code'),
  data?: {
    content?: string(name='Content'),
    procEnv?: string(name='ProcEnv'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model TransferResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TransferResourceResponseBody(name='body'),
}

async function transferResourceWithOptions(request: TransferResourceRequest, runtime: Util.RuntimeOptions): TransferResourceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.actionCode)) {
    body['ActionCode'] = request.actionCode;
  }
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TransferResource',
    version = '2019-12-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function transferResource(request: TransferResourceRequest): TransferResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return transferResourceWithOptions(request, runtime);
}

